package org.txazo.music.commons.mp3;

import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;

import org.txazo.music.util.md5.MD5;

/**
 * MP3图像提取
 * 
 * @author Tu XiaoZhou
 * @since 2013-04-12
 * 
 */
public class MP3ImageWriter {

	/**
	 * 写入MP3图像
	 */
	public static void writeImage(byte[] data, String file) {
		try (BufferedOutputStream bos = new BufferedOutputStream(
				new FileOutputStream(MP3Util.IMAGES_MP3 + MD5.md5(file)
						+ MP3Util.SUFFIX_JPG))) {
			bos.write(data);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
